HAL GFXTIM I/O operations migration

This section provides information about the HAL GFXTIM function migration.

HAL GFXTIM configure the clock generator

HAL1

HAL2

HAL_StatusTypeDef HAL_GFXTIM_ClockGenerator_Config(GFXTIM_HandleTypeDef *hgfxtim,
                                                   const GFXTIM_ClockGeneratorConfigTypeDef *pClockGeneratorConfig);
hal_status_t HAL_GFXTIM_CLKGEN_SetConfigLineFrameClock(hal_gfxtim_handle_t *hgfxtim,
                                                       const hal_gfxtim_clkgen_frame_config_t *p_frame_clk_config,
                                                       const hal_gfxtim_clkgen_line_config_t *p_line_clk_config);
hal_status_t HAL_GFXTIM_CLKGEN_SetConfigFrameClock(hal_gfxtim_handle_t *hgfxtim,
                                                   const hal_gfxtim_clkgen_frame_config_t *p_clk_config);

Usage example:

/* Configure the GFXTIM line frame clock generator */
GFXTIM_ClockGeneratorConfigTypeDef ClockGenConfig = {
.LCCHwReloadSrc  = GFXTIM_LCC_HW_RELOAD_SRC_NONE;
.LCCReloadValue  = 159999;
.LCCClockSrc     = GFXTIM_LCC_CLK_SRC_SYSCLOCK;
.LineClockSrc    = GFXTIM_LINE_CLK_SRC_LCC_UNDERFLOW;


.FCCHwReloadSrc  = GFXTIM_FCC_HW_RELOAD_SRC_NONE;
.FCCReloadValue  = 0xFU;
.FCCClockSrc     = GFXTIM_FCC_CLK_SRC_DISABLE;
.FrameClockSrc   = GFXTIM_FRAME_CLK_SRC_FCC_UNDERFLOW;
.LineClockCalib  = GFXTIM_LINE_CLK_CALIB_DISABLE;
.FrameClockCalib = GFXTIM_FRAME_CLK_CALIB_DISABLE;
};
HAL_GFXTIM_ClockGenerator_Config(&hgfxtim,
                                 &pClockGeneratorConfig);


/* Configure the GFXTIM frame clock generator */
GFXTIM_ClockGeneratorConfigTypeDef pClockGenConfig = {
.LineClockSrc    = GFXTIM_LINE_CLK_SRC_FCC_UNDERFLOW;
.FCCHwReloadSrc  = GFXTIM_FCC_HW_RELOAD_SRC_NONE;
.FCCReloadValue  = 1;
.FCCClockSrc     = GFXTIM_FCC_CLK_SRC_HSYNC_RISING;
.FrameClockSrc   = GFXTIM_FRAME_CLK_SRC_FCC_UNDERFLOW;
.LineClockCalib  = GFXTIM_LINE_CLK_CALIB_DISABLE;
.FrameClockCalib = GFXTIM_FRAME_CLK_CALIB_DISABLE;
};
HAL_GFXTIM_ClockGenerator_Config(&hgfxtim,
                                 &pClockGenConfig);

Usage example:

/* Configure the GFXTIM line frame clock generator */
hal_gfxtim_clkgen_line_config_t p_line_config = {
.reload_src   = HAL_GFXTIM_CLKGEN_LCNT_NO_RELOAD;
.reload_val   = 159999;
.counter_src  = HAL_GFXTIM_CLKGEN_LINE_COUNT_GFXTIMHCLK;
.clock_src    = HAL_GFXTIM_CLKGEN_LINE_LCNT_UNDERFLOW;
 };
hal_gfxtim_clkgen_frame_config_t p_frame_config = {
.reload_src  = HAL_GFXTIM_CLKGEN_FCNT_NO_RELOAD;
.reload_val  = 0xFU;
.counter_src = HAL_GFXTIM_CLKGEN_FCNT_DISABLE;
.clock_src   = HAL_GFXTIM_CLKGEN_FRAME_FCNT_UNDERFLOW;
};


HAL_GFXTIM_CLKGEN_SetConfigLineFrameClock(&hgfxtim,
                                          &p_frame_config,
                                          &p_line_config);


/* Configure the GFXTIM frame clock generator */
hal_gfxtim_clkgen_frame_config_t p_frame_config = {

.reload_src  = HAL_GFXTIM_CLKGEN_FCNT_NO_RELOAD;
.reload_val  = 1;
.counter_src = HAL_GFXTIM_CLKGEN_FCNT_HSYNC_RISING;
.clock_src   = HAL_GFXTIM_CLKGEN_FRAME_FCNT_UNDERFLOW;
};


HAL_GFXTIM_CLKGEN_SetConfigFrameClock(&hgfxtim,
                                      &p_frame_config);

HAL GFXTIM reload the clock generator configuration

HAL1

HAL2

HAL_StatusTypeDef HAL_GFXTIM_ClockGenerator_Reload(GFXTIM_HandleTypeDef *hgfxtim,
                                                   uint32_t ClockGeneratorCounter);
hal_status_t HAL_GFXTIM_CLKGEN_ForceReloadCounter(hal_gfxtim_handle_t *hgfxtim,
                                                  hal_gfxtim_clkgen_counter_t counter);

HAL GFXTIM Configure the absolute timer

HAL1

HAL2

HAL_StatusTypeDef HAL_GFXTIM_AbsoluteTimer_Config(GFXTIM_HandleTypeDef *hgfxtim,
                                                  const GFXTIM_AbsoluteTimerConfigTypeDef *pAbsoluteTimerConfig);
hal_status_t HAL_GFXTIM_ABSTIM_SetFrameCompareValue(hal_gfxtim_handle_t *hgfxtim, uint32_t val);
hal_status_t HAL_GFXTIM_ABSTIM_SetFrameCounter(const hal_gfxtim_handle_t *hgfxtim, uint32_t val);

hal_status_t HAL_GFXTIM_ABSTIM_SetLineCompareValue(hal_gfxtim_handle_t *hgfxtim,
                                                   hal_gfxtim_abstim_line_comp_t line_comp, uint32_t val);
hal_status_t HAL_GFXTIM_ABSTIM_SetLineCounter(const hal_gfxtim_handle_t *hgfxtim, uint32_t val);

hal_status_t HAL_GFXTIM_ABSTIM_Start(hal_gfxtim_handle_t *hgfxtim,
                                     hal_gfxtim_abstim_counter_t counter,
                                     uint32_t interrupts);

For more details, see HAL GFXTIM absolute timer configuration type definition

Related use cases:


HAL GFXTIM get the current counter value of the absolute timer

HAL1

HAL2

HAL_StatusTypeDef HAL_GFXTIM_AbsoluteTimer_GetCounter(const GFXTIM_HandleTypeDef *hgfxtim,
                                                      uint32_t AbsoluteTime,
                                                      uint32_t *pValue);
void HAL_GFXTIM_ABSTIM_GetCounter(hal_gfxtim_handle_t *hgfxtim,
                                  uint32_t *p_frame,
                                  uint32_t *p_line);
uint32_t HAL_GFXTIM_ABSTIM_GetFrameCounter(hal_gfxtim_handle_t *hgfxtim);
uint32_t HAL_GFXTIM_ABSTIM_GetLineCounter(hal_gfxtim_handle_t *hgfxtim);

Usage example:

uint32_t value;
/* Get the absolute line and frame counter */
HAL_GFXTIM_AbsoluteTimer_GetCounter(&hgfxtim, GFXTIM_ABSOLUTE_GLOBAL_TIME, &value);
/* Get the absolute line counter */
HAL_GFXTIM_AbsoluteTimer_GetCounter(&hgfxtim, GFXTIM_ABSOLUTE_LINE_TIME, &value);
/* Get the absolute frame counter */
HAL_GFXTIM_AbsoluteTimer_GetCounter(&hgfxtim, GFXTIM_ABSOLUTE_FRAME_TIME, &value);

Usage example:

uint32_t frame_value, line_value ;
/* Get the absolute line and frame counter */
HAL_GFXTIM_ABSTIM_GetCounter(&hgfxtim,&frame_value, &line_value);
/* Get the absolute line counter */
line_value = HAL_GFXTIM_ABSTIM_GetLineCounter(&hgfxtim);
/* Get the absolute frame counter */
frame_value = HAL_GFXTIM_ABSTIM_GetFrameCounter(&hgfxtim);

HAL GFXTIM reset the absolute timer counter

HAL1

HAL2

HAL_StatusTypeDef HAL_GFXTIM_AbsoluteTimer_Reset(GFXTIM_HandleTypeDef *hgfxtim);
hal_status_t HAL_GFXTIM_ABSTIM_Reset(hal_gfxtim_handle_t *hgfxtim,
                                     hal_gfxtim_abstim_counter_t counter);

Usage example:

/* Reset the absolute line frame*/
HAL_GFXTIM_AbsoluteTimer_Reset(&hgfxtim);

Usage example:

/* Reset the absolute line frame */
HAL_GFXTIM_ABSTIM_Reset(&hgfxtim, HAL_GFXTIM_ABSTIM_LINE_FRAME_COUNTER);

HAL GFXTIM set the frame compare value for the absolute timer

HAL1

HAL2

HAL_StatusTypeDef HAL_GFXTIM_AbsoluteTimer_SetFrameCompare(GFXTIM_HandleTypeDef *hgfxtim,
                                                           uint32_t Value);
hal_status_t HAL_GFXTIM_ABSTIM_SetFrameCompareValue(hal_gfxtim_handle_t *hgfxtim,
                                                    uint32_t val);

HAL GFXTIM set the line compare value for the absolute timer

HAL1

HAL2

HAL_StatusTypeDef HAL_GFXTIM_AbsoluteTimer_SetLineCompare(GFXTIM_HandleTypeDef *hgfxtim,
                                                          uint32_t AbsoluteLineComparator,
                                                          uint32_t Value)
hal_status_t HAL_GFXTIM_ABSTIM_SetLineCompareValue(hal_gfxtim_handle_t *hgfxtim,
                                                   hal_gfxtim_abstim_line_comp_t line_comp,
                                                   uint32_t val);

HAL GFXTIM start the absolute timer

HAL1

HAL2

HAL_StatusTypeDef HAL_GFXTIM_AbsoluteTimer_Start(GFXTIM_HandleTypeDef *hgfxtim);
hal_status_t HAL_GFXTIM_ABSTIM_Start(hal_gfxtim_handle_t *hgfxtim,
                                     hal_gfxtim_abstim_counter_t counter,
                                     uint32_t interrupts);

Related use cases:


HAL GFXTIM stop the absolute timer

HAL1

HAL2

HAL_StatusTypeDef HAL_GFXTIM_AbsoluteTimer_Stop(GFXTIM_HandleTypeDef *hgfxtim);
hal_status_t HAL_GFXTIM_ABSTIM_Stop(hal_gfxtim_handle_t *hgfxtim,
                                    hal_gfxtim_abstim_counter_t counter);

Usage example:

/* Stop the absolute line frame*/
HAL_GFXTIM_AbsoluteTimer_Stop(&hgfxtim);

Usage example:

/* Stop the absolute line frame */
HAL_GFXTIM_ABSTIM_Stop(&hgfxtim, HAL_GFXTIM_ABSTIM_LINE_FRAME_COUNTER);

HAL GFXTIM configure the relative timer

HAL1

HAL2

HAL_StatusTypeDef HAL_GFXTIM_RelativeTimer_Config(GFXTIM_HandleTypeDef *hgfxtim,
                                                  const GFXTIM_RelativeTimerConfigTypeDef *pRelativeTimerConfig,
                                                  uint32_t RelativeTimer);
Removed:

The function HAL_GFXTIM_RelativeTimer_Config has been merged with HAL_GFXTIM_RelativeTimer_Start to provide starting
relative counter with the appropriate mode (continuous or one shot).

For more details, refer to HAL GFXTIM start the relative timer

Related use cases: Use case: Starting the GFXTIM with relative timer


HAL GFXTIM force reload of the relative timer

HAL1

HAL2

HAL_StatusTypeDef HAL_GFXTIM_RelativeTimer_ForceReload(GFXTIM_HandleTypeDef *hgfxtim,
                                                       uint32_t RelativeTimer);
hal_status_t HAL_GFXTIM_RELTIM_ForceReload(hal_gfxtim_handle_t *hgfxtim,
                                           hal_gfxtim_reltim_counter_t counter);

HAL GFXTIM get the current counter value of the relative timer

HAL1

HAL2

HAL_StatusTypeDef HAL_GFXTIM_RelativeTimer_GetCounter(const GFXTIM_HandleTypeDef *hgfxtim,
                                                      uint32_t RelativeTimer,
                                                      uint32_t *pValue)
uint32_t HAL_GFXTIM_RELTIM_GetCounter(const hal_gfxtim_handle_t *hgfxtim,
                                      hal_gfxtim_reltim_counter_t counter);

Usage example:

uint32_t value;
HAL_GFXTIM_RelativeTimer_GetCounter(&hgfxtim, GFXTIM_RELATIVE_TIMER1, &value);

Usage example:

uint32_t value;
value = HAL_GFXTIM_RELTIM_GetCounter(&hgfxtim, HAL_GFXTIM_RELTIM_COUNTER_1);

HAL GFXTIM set the reload value for the relative timer

HAL1

HAL2

HAL_StatusTypeDef HAL_GFXTIM_RelativeTimer_SetReload(GFXTIM_HandleTypeDef *hgfxtim,
                                                     uint32_t RelativeTimer,
                                                     uint32_t Value);
hal_status_t HAL_GFXTIM_RELTIM_SetReloadValue(hal_gfxtim_handle_t *hgfxtim,
                                              hal_gfxtim_reltim_counter_t counter,
                                              uint32_t autoreload_val);

HAL GFXTIM start the relative timer

HAL1

HAL2

HAL_StatusTypeDef HAL_GFXTIM_RelativeTimer_Start(GFXTIM_HandleTypeDef *hgfxtim,
                                                 uint32_t RelativeTimer);
hal_status_t HAL_GFXTIM_RELTIM_StartContinuous(hal_gfxtim_handle_t *hgfxtim,
                                               hal_gfxtim_reltim_counter_t counter,
                                               uint32_t autoreload_val,
                                               uint32_t interrupt);

hal_status_t HAL_GFXTIM_RELTIM_StartOneShot(hal_gfxtim_handle_t *hgfxtim,
                                            hal_gfxtim_reltim_counter_t counter,
                                            uint32_t autoreload_val,
                                            uint32_t interrupt);

Usage example:

/* Configure and start the relative frame counter in one shot mode */
GFXTIM_RelativeTimerConfigTypeDef pRelativeTimerConfig = {
.CounterMode = GFXTIM_MODE_ONE_SHOT;

.AutoReloadValue = 200;
.ReloadInterrupt = ENABLE;
};
HAL_GFXTIM_RelativeTimer_Config(&hgfxtim,
                                &pRelativeTimerConfig,
                                GFXTIM_RELATIVE_TIMER1);
HAL_GFXTIM_RelativeTimer_Start(&hgfxtim,
                                GFXTIM_RELATIVE_TIMER1);

/* Configure and start the relative frame counter in continuous mode */
GFXTIM_RelativeTimerConfigTypeDef pRelativeTimerConfig = {
.CounterMode = GFXTIM_MODE_CONTINUOUS;

.AutoReloadValue = 200;
.ReloadInterrupt = ENABLE;
};
HAL_GFXTIM_RelativeTimer_Config(&hgfxtim,
                                &pRelativeTimerConfig,
                                GFXTIM_RELATIVE_TIMER2);
HAL_GFXTIM_RelativeTimer_Start(&hgfxtim,
                                GFXTIM_RELATIVE_TIMER2);

Usage example:

/* Configure and start the relative frame counter in one shot mode */

HAL_GFXTIM_RELTIM_StartOneShot(&hgfxtim,
                               HAL_GFXTIM_RELTIM_COUNTER_1,
                               200U,
                               HAL_GFXTIM_RELTIM_COUNT_IT);







/* Configure and start the relative frame counter in continuous mode */

HAL_GFXTIM_RELTIM_StartContinuous(&hgfxtim,
                                HAL_GFXTIM_RELTIM_COUNTER_2,
                                200U,
                                HAL_GFXTIM_RELTIM_COUNT_IT);

Related use cases: Use case: Starting the GFXTIM with relative timer


HAL GFXTIM stop the relative timer

HAL1

HAL2

HAL_StatusTypeDef HAL_GFXTIM_RelativeTimer_Stop(GFXTIM_HandleTypeDef *hgfxtim,
                                                uint32_t RelativeTimer);
hal_status_t HAL_GFXTIM_RELTIM_StopContinuous(hal_gfxtim_handle_t *hgfxtim,
                                              hal_gfxtim_reltim_counter_t counter);

HAL GFXTIM configure the event generator

HAL1

HAL2

HAL_StatusTypeDef HAL_GFXTIM_EventGenerator_Config(GFXTIM_HandleTypeDef *hgfxtim,
                                                   uint32_t EventGenerator,
                                                   const GFXTIM_EventGeneratorConfigTypeDef *pEventGeneratorConfig);
hal_status_t HAL_GFXTIM_EVENTGEN_SetConfig(hal_gfxtim_handle_t *hgfxtim,
                                           hal_gfxtim_eventgen_event_t event_gen,
                                           const hal_gfxtim_eventgen_config_t *p_config);

For more details, refer to HAL GFXTIM event generator configuration type definition.

Related use cases: Use case: Starting the GFXTIM with event generator


HAL GFXTIM disable the event generator

HAL1

HAL2

HAL_StatusTypeDef HAL_GFXTIM_EventGenerator_Disable(GFXTIM_HandleTypeDef *hgfxtim,
                                                    uint32_t EventGenerator);
hal_status_t HAL_GFXTIM_EVENTGEN_Stop(const hal_gfxtim_handle_t *hgfxtim,
                                      hal_gfxtim_eventgen_event_t event_gen);

HAL GFXTIM enable the event generator

HAL1

HAL2

HAL_StatusTypeDef HAL_GFXTIM_EventGenerator_Enable(GFXTIM_HandleTypeDef *hgfxtim,
                                                   uint32_t EventGenerator);
hal_status_t HAL_GFXTIM_EVENTGEN_Start(const hal_gfxtim_handle_t *hgfxtim,
                                       hal_gfxtim_eventgen_event_t event_gen,
                                       uint32_t interrupt);

For more details, refer to HAL GFXTIM event generator configuration type definition.

Related use cases: Use case: Starting the GFXTIM with event generator


HAL GFXTIM configure the watchdog timer

HAL1

HAL2

HAL_StatusTypeDef HAL_GFXTIM_WatchdogTimer_Config(GFXTIM_HandleTypeDef *hgfxtim,
                                                  const GFXTIM_WatchdogConfigTypeDef *pWatchdogConfig)
hal_status_t HAL_GFXTIM_WDG_SetConfig(hal_gfxtim_handle_t *hgfxtim,
                                      const hal_gfxtim_wdg_config_t *p_config);

For more details, refer to HAL GFXTIM watchdog configuration type definition.

Related use cases: Use case: Starting the GFXTIM with watchdog timer


HAL GFXTIM disable the watchdog timer

HAL1

HAL2

HAL_StatusTypeDef HAL_GFXTIM_WatchdogTimer_Disable(GFXTIM_HandleTypeDef *hgfxtim);
hal_status_t HAL_GFXTIM_WDG_Stop(hal_gfxtim_handle_t *hgfxtim);

HAL GFXTIM enable the watchdog timer

HAL1

HAL2

HAL_StatusTypeDef HAL_GFXTIM_WatchdogTimer_Enable(GFXTIM_HandleTypeDef *hgfxtim);

In HAL2, this function has been renamed with adding configuration parameters (auto reload value, pre-alarm value and interrupts).

hal_status_t HAL_GFXTIM_WDG_Start(hal_gfxtim_handle_t *hgfxtim,
                                  uint32_t reload_val,
                                  uint32_t prealarm_val,
                                  uint32_t interrupts);

For more details, refer to HAL GFXTIM watchdog configuration type definition.

Related use cases: Use case: Starting the GFXTIM with watchdog timer


HAL GFXTIM refresh the watchdog timer

HAL1

HAL2

HAL_StatusTypeDef HAL_GFXTIM_WatchdogTimer_Refresh(GFXTIM_HandleTypeDef *hgfxtim);
hal_status_t HAL_GFXTIM_WDG_Refresh(hal_gfxtim_handle_t *hgfxtim);